Write a custom CUDA kernel to optimize `ReLTanh` (Rectified Linear Tanh).

Formula (3-piece piecewise):
  Let k = 1 - tanh^2(a)
  f(x) = k*x - k*a + tanh(a)   if x > a
  f(x) = tanh(x)               if -a <= x <= a
  f(x) = k*x + k*a - tanh(a)   if x < -a

Problem Analysis:
1. Memory Bound: This is a point-wise activation with complex branching logic.
2. Operator Chaining: A PyTorch implementation requires `torch.where` or boolean masking, creating multiple intermediate tensors.

Optimization Strategy: Fused Element-wise Kernel with Vectorization

1. One-Thread-per-Element: Map each element to a CUDA thread.

2. Vectorized Loads (float4): Use `float4` to process 128 bits per memory transaction.

3. Fused Branching Logic:
   - Pre-compute constants `k`, `tanh(a)`, `k*a` on the host.
   - For each element `x`:
     `if (x > a)`: compute linear part.
     `else if (x < -a)`: compute linear part.
     `else`: compute `tanhf(x)`.

4. One-Pass: Fuse all steps into a single read-compute-write kernel.
  
Here's an example to show you the syntax of inline embedding custom CUDA operators in torch: The example given architecture is:   
  
```python
import torch
import torch.nn as nn
import math

BATCH_SIZE = 4096
HIDDEN_DIM = 4096
SHAPE = (BATCH_SIZE, HIDDEN_DIM)

A_VALUE = 2.0

class ReLTanh(nn.Module):
    """
    ReLTanh: An activation function(Neurocomputing, 2019)
    Formula (3-piece piecewise):
      Let k = 1 - tanh^2(a)
      f(x) = k*x - k*a + tanh(a)   if x > a
      f(x) = tanh(x)               if -a <= x <= a
      f(x) = k*x + k*a - tanh(a)   if x < -a
    """
    def __init__(self, a=2.0):
        super(ReLTanh, self).__init__()
        self.a = a
        # Pre-compute constants
        self.tanh_a = math.tanh(a)
        self.k = 1.0 - self.tanh_a**2

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        # Center part
        center_part = torch.tanh(x)
        
        # Positive linear part
        pos_part = self.k * x - self.k * self.a + self.tanh_a
        
        # Negative linear part
        neg_part = self.k * x + self.k * self.a - self.tanh_a
        
        # Combine with two where clauses
        output = torch.where(x > self.a, pos_part, center_part)
        output = torch.where(x < -self.a, neg_part, output)
        
        return output

class Model(nn.Module):
    def __init__(self, a=2.0):
        super(Model, self).__init__()
        self.act = ReLTanh(a=a)
    
    def forward(self, x):
        return self.act(x)

def get_inputs():
    input_tensor = torch.randn(SHAPE, dtype=torch.float32) * 5.0
    return [input_tensor.contiguous()]

def get_init_inputs():
    return [A_VALUE]